<%@ page pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<jsp:include page="common/header.jsp"></jsp:include>
<input type="hidden" name="projectName" id="projectName" value="${pageContext.request.contextPath }"/>
<h1><img src="${pageContext.request.contextPath}/views/images/icons/posts.png" alt="" /> 角色管理</h1>

    <div class="bloc">
	    <div class="title">修改角色</div><input type="hidden" id="role_id" value="${role.id }"/>
	    <div class="content">
	        <div class="input">
	            <label for="input1">角色名称</label>
	            <input type="text" id="role_name" value="${role.name }"/>
	        </div>
	        <div class="input long">
	            <label for="input3">角色描述</label>
	            <input type="text" id="role_description" value="${role.description }"/>
	        </div>
	        
	        <table style="margin-top:10px;">
	            <thead>
	                <tr>
	                    <th><input type="checkbox" class="checkall"/></th>
	                    <th>名称</th>
	                    <th>描述</th>
	                    <!-- <th style="text-align:center;">操作</th> -->
	                </tr>
	            </thead>
	            <tbody>
		        <c:forEach items="${modules}" var="item">
	           		<c:if test="${item.type==0}">
	           		<tr style="color:red; font-weight:bold; font-size:16px; line-height:20px;">
	           			<td></td>
	                    <td>${item.name}</td>
	                    <td>${item.description}</td>
	                    <!-- <td class="actions"></td> -->
	                </tr>
	           		</c:if>
	           		<c:if test="${item.type==1}">
	           		<tr>
	           			<td>
	           				<input type="checkbox" 
	           				<c:forEach items="${role.modules }" var="item1">
				        		<c:if test="${item1.id==item.id }">
				        			checked="checked"
				        		</c:if>
				        	</c:forEach>
				        	/>
		                    <input type="hidden" value="${item.id }"/>
	                    </td>
	                    <td>${item.name}</td>
	                    <td>${item.description}</td>
	           		</tr>
	           		</c:if>
	                
	           	</c:forEach>
	           	</tbody>
	       </table>
	        
	        
	        <div class="submit" style="margin-top:20px;">
	            <input type="button" value="保存" onclick="updaterole()" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	            <input type="button" value="取消" class="white" onclick="javascript:location.href='${pageContext.request.contextPath}/admin-role/index';"/>
	        </div>
	    </div>
	</div>

<%-- </form:form> --%>
<script type="text/javascript" src="${pageContext.request.contextPath}/views/js/role_update.js"></script>